<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html><!-- InstanceBegin template="/Templates/Function Info.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<!-- InstanceBeginEditable name="doctitle" -->
<title>WinXDrawImage</title>
<!-- InstanceEndEditable -->
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<!-- InstanceBeginEditable name="head" --><!-- InstanceEndEditable -->
<style type="text/css">
<!--
.style3 {font-size: medium}
-->
</style>

<link href="../../WinXStyles.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.style1 {
	font-size: x-large;
	font-family: Verdana, Arial, Helvetica, sans-serif;
}
.style2 {
	font-size: large;
	font-family: Verdana, Arial, Helvetica, sans-serif;
}
-->
</style>
</head>

<body>
<h1 class="style1"><img src="../../WinX48.png" width="48" height="48" align="absmiddle"> <!-- InstanceBeginEditable name="title" -->WinXDrawImage<!-- InstanceEndEditable --></h1>
<hr>

<!-- InstanceBeginEditable name="Prototype" -->
<p>hElement = WinXDrawImage (hWnd, hImage, x, y, w, h, xSrc, ySrc, blend)</p>
<!-- InstanceEndEditable --><!-- InstanceBeginEditable name="Description" -->
<p>Draws an image </p>
<!-- InstanceEndEditable -->
<table width="80%" border="1" cellpadding="0" cellspacing="0">
  <tr bgcolor="#CCCCCC">
    <th width="24%"><span class="style3">Parameter</span></th>
    <th width="76%"><span class="style3">Description</span></th>
  </tr>
  <!-- InstanceBeginRepeat name="Parameter Table" --><!-- InstanceBeginRepeatEntry -->
  <tr bgcolor="#E8E8E8">
    <td><!-- InstanceBeginEditable name="Parameter" -->hWnd<!-- InstanceEndEditable --></td>
    <td><!-- InstanceBeginEditable name="Description" -->The handle to the window to draw the image on <!-- InstanceEndEditable --></td>
  </tr>
  <!-- InstanceEndRepeatEntry --><!-- InstanceBeginRepeatEntry -->
  <tr bgcolor="#E8E8E8">
    <td><!-- InstanceBeginEditable name="Parameter" -->hImage<!-- InstanceEndEditable --></td>
    <td><!-- InstanceBeginEditable name="Description" -->The handle to the image to draw <!-- InstanceEndEditable --></td>
  </tr>
  <!-- InstanceEndRepeatEntry --><!-- InstanceBeginRepeatEntry -->
  <tr bgcolor="#E8E8E8">
    <td><!-- InstanceBeginEditable name="Parameter" -->x<!-- InstanceEndEditable --></td>
    <td><!-- InstanceBeginEditable name="Description" -->The x coordinate of the upper left hand corner of the drawn image <!-- InstanceEndEditable --></td>
  </tr>
  <!-- InstanceEndRepeatEntry --><!-- InstanceBeginRepeatEntry -->
  <tr bgcolor="#E8E8E8">
    <td><!-- InstanceBeginEditable name="Parameter" -->y<!-- InstanceEndEditable --></td>
    <td><!-- InstanceBeginEditable name="Description" -->The y coordinate of the upper left hand corner of the drawn image <!-- InstanceEndEditable --></td>
  </tr>
  <!-- InstanceEndRepeatEntry --><!-- InstanceBeginRepeatEntry -->
  <tr bgcolor="#E8E8E8">
    <td><!-- InstanceBeginEditable name="Parameter" -->w<!-- InstanceEndEditable --></td>
    <td><!-- InstanceBeginEditable name="Description" -->The number of pixels horizontally to draw <!-- InstanceEndEditable --></td>
  </tr>
  <!-- InstanceEndRepeatEntry --><!-- InstanceBeginRepeatEntry -->
  <tr bgcolor="#E8E8E8">
    <td><!-- InstanceBeginEditable name="Parameter" -->h<!-- InstanceEndEditable --></td>
    <td><!-- InstanceBeginEditable name="Description" -->The number of pixels vertically to draw <!-- InstanceEndEditable --></td>
  </tr>
  <!-- InstanceEndRepeatEntry --><!-- InstanceBeginRepeatEntry -->
  <tr bgcolor="#E8E8E8">
    <td><!-- InstanceBeginEditable name="Parameter" -->xSrc<!-- InstanceEndEditable --></td>
    <td><!-- InstanceBeginEditable name="Description" -->The x coordinate of the source rectangle<!-- InstanceEndEditable --></td>
  </tr>
  <!-- InstanceEndRepeatEntry --><!-- InstanceBeginRepeatEntry -->
  <tr bgcolor="#E8E8E8">
    <td><!-- InstanceBeginEditable name="Parameter" -->ySrc<!-- InstanceEndEditable --></td>
    <td><!-- InstanceBeginEditable name="Description" -->The y coordinate of the source rectangle<!-- InstanceEndEditable --></td>
  </tr>
  <!-- InstanceEndRepeatEntry --><!-- InstanceBeginRepeatEntry -->
  <tr bgcolor="#E8E8E8">
    <td><!-- InstanceBeginEditable name="Parameter" -->blend<!-- InstanceEndEditable --></td>
    <td><!-- InstanceBeginEditable name="Description" -->$$TRUE to alpha blend the image, $$FALSE not to <!-- InstanceEndEditable --></td>
  </tr>
  <!-- InstanceEndRepeatEntry --><!-- InstanceEndRepeat -->
</table>
<h3>Returns</h3>
<!-- InstanceBeginEditable name="Return Info" -->
<p>The id of the drawn image or -1 on fail </p>
<!-- InstanceEndEditable -->
<h3>Remarks</h3>
<!-- InstanceBeginEditable name="Remarks" -->
<p>If you register the <a href="../Callbacks.htm/onPaint.htm">onPaint</a> callback, this function has no effect. The image will not be visible untill you call the <a href="WinXUpdate.htm">WinXUpdate</a> function. You can use the id returned by this function to undo the image with the <a href="WinXUndo.htm">WinXUndo</a> function. </p>
<p>This function copies a rectangle from the image to the specified window. The xSrc and ySrc parameters describe where this rectangle comes from on the source image. You can use these parameters, along with the w and h parameters to draw only part of an image. This allows you to store several graphical elements in a single image. </p>
<p>To use alpha blending you must first premultiply the image with the <a href="../Images.htm/WinXDraw_PremultiplyImage.htm">WinXDraw_PremultiplyImage</a> function. </p>
<!-- InstanceEndEditable -->
<h3>Examples</h3>
<table width="80%"  border="0">
  <tr>
    <td bgcolor="#C6C6FF"><!-- InstanceBeginEditable name="Example Code" -->
      <p class="codeStyle">'load an image and draw it<br>
        extensions$ =       &quot;Bitmap Files (*.bmp)\0*.bmp\0All Files (*.*)\0*.*\0\0&quot;<br>
        fileName$ = WinXDialog_OpenFile$ (#hMain, &quot;Open Bitmap&quot;, extensions$, &quot;&quot;, $$FALSE)
        <br>
      hImage = WinXDraw_LoadImage (fileName$, $$FILETYPE_WINBMP)<br>
      WinXDraw_GetImageInfo (hImage, @w, @h, @pBits)      <br>
      WinXDrawImage (#hMain, hImage, 0, 0, w, h, 0, 0, $$FALSE)</p>
      <!-- InstanceEndEditable --></td>
  </tr>
</table>

<h2 class="style2">Related Links</h2>
<!-- InstanceBeginEditable name="Related Links" -->
<p><a href="../Images.htm/WinXDraw_CreateImage.htm">WinXDraw_CreateImage</a><br>
<a href="../Images.htm/WinXDraw_LoadImage.htm">WinXDraw_LoadImage</a><br>
<a href="../Images.htm/WinXDraw_Snapshot.htm">WinXDraw_Snapshot</a><br>
<a href="../Images.htm/WinXDraw_ResizeImage.htm">WinXDraw_ResizeImage</a><br>
<a href="../Images.htm/WinXDraw_SetImagePixel.htm">WinXDraw_SetImagePixel</a><br>
<a href="../Images.htm/WinXDraw_SetConstantAlpha.htm">WinXDraw_SetConstantAlpha</a><br>
<a href="../Images.htm/WinXDraw_SetImageChannel.htm">WinXDraw_SetImageChannel</a><br>
<a href="../Images.htm/WinXDraw_GetImageInfo.htm">WinXDraw_GetImageInfo</a><br>
<a href="../Images.htm/WinXDraw_PremultiplyImage.htm">WinXDraw_PremultiplyImage</a></p>
<!-- InstanceEndEditable -->
</body>
<!-- InstanceEnd --></html>
